import executor.GameExecutor;
import model.Board;
import rule.KalilonRuleOperator;

public class Main {

    public static void main(String[] args) {
        System.out.println("Hello World!");
        System.out.println(3>>1);

        //set the real table to this board
        Board board = new Board(7, 5);
//        board.setLine(0, "01110");
//        board.setLine(1, "10001");
//        board.setLine(2, "01101");
//        board.setLine(3, "01010");
//        board.setLine(4, "01010");
//        board.setLine(5, "10011");
//        board.setLine(6, "10000");

        board.setLine(0, "01001");
        board.setLine(1, "10001");
        board.setLine(2, "01110");
        board.setLine(3, "01010");
        board.setLine(4, "00100");
        board.setLine(5, "00010");
        board.setLine(6, "10000");

        calc(board);
    }

    public static void calc(Board board){
        GameExecutor gameExecutor = new GameExecutor(new KalilonRuleOperator());
        gameExecutor.setBoard(board);

        long startTime = System.currentTimeMillis();
        gameExecutor.calc();
        System.out.println("timecost:" + (System.currentTimeMillis() - startTime));
    }

    public static void validate(Board board){
        GameExecutor gameExecutor = new GameExecutor(new KalilonRuleOperator());
        gameExecutor.setBoard(board);
        gameExecutor.operate(board, Integer.parseInt("01110", 2), 0);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("01110", 2), 1);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("01001", 2), 2);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("00100", 2), 3);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("10010", 2), 4);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("00110", 2), 5);
        gameExecutor.printTable(board.table);
        gameExecutor.operate(board, Integer.parseInt("11010", 2), 6);
        gameExecutor.printTable(board.table);
    }
}
